package main

import (
	"flag"
	"github.com/gin-gonic/gin"
	"github.com/prometheus/client_golang/prometheus/promhttp"
	"xiaofei-demo/app/service/internal/conf"
	"xiaofei-demo/pkg/prometheus"
)

func init() {
}


func main() {
	flag.Parse()
	if err := conf.Init();err != nil{
		panic(err)
	}

	r := gin.Default()
	// prometheus 中间件
	ps := prometheus.NewPrometheusMonitor(conf.AppConfig.NameSpace, conf.AppConfig.AppName)
	r.Use(ps.PromMiddleware())
	r.GET("/metrics", gin.WrapH(promhttp.Handler()))
	_ = initApp(r)
	r.Run(conf.AppConfig.Listen)
}
